package com.leo.java;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;

/**
 *
 * @author xuexiaolei
 * @version 2018年01月09日
 */
public class Test {
    public static void main(String[] args) {
        List<String> a = new ArrayList<>();
        a.add("0");
        a.add("1");
        a.add("2");
        ListIterator<String> iterator = a.listIterator();
        System.out.println(iterator.next());
        System.out.println(iterator.next());
        System.out.println(iterator.previous());
        iterator.add("3");
        iterator.add("4");
        p(a);
    }
    public static <E> void p(Collection<E> c){
        for (E item : c){
            System.out.print(item + "     ");
        }
        System.out.println();
    }
}
